package de.koller.worlders.engine.tiles.landscape.level;

import de.koller.oceanFramework.util.ColorIntUtil;
import de.koller.worlders.WorldersRoot;
import de.koller.worlders.engine.entity.deco.Gem;
import de.koller.worlders.engine.entity.plattform.DeathPlattform;
import de.koller.worlders.engine.entity.plattform.SolidPlattform;
import de.koller.worlders.engine.entity.zone.NegatorZone;
import de.koller.worlders.engine.tiles.landscape.IGenerate;
import de.koller.worlders.engine.tiles.landscape.LandscapeGenerator;
import de.koller.worlders.engine.tiles.landscape.OreGeneration;
import de.koller.worlders.engine.tiles.landscape.PlayerGeneration;
import java.awt.image.BufferedImage;

public class BasicLayer extends LandscapeGenerator {

	public BasicLayer( WorldersRoot wroot ) {
		super( wroot );
	}

	@Override
	public IGenerate generate( long segX, long segY, BufferedImage map, BufferedImage light ) {
		for( int tx = 0; tx < map.getWidth(); tx++ )
			for( int ty = 0; ty < map.getHeight(); ty++ ) {
				map.setRGB( tx, ty, ColorIntUtil.getIntColor( SolidPlattform.GEN_ID, 4, 0xff, 0xff ) );
				light.setRGB( tx, ty, 0xff000000 );
			}
		
		new OreGeneration( ColorIntUtil.getIntColor( SolidPlattform.GEN_ID, 4, Gem.GEN_ID, 0 ), 60, 3 ).generate( map );
		new OreGeneration( ColorIntUtil.getIntColor( NegatorZone.GEN_ID, 0, 0, 0 ), 30, 0 ).generate( map );
		new OreGeneration( ColorIntUtil.getIntColor( DeathPlattform.GEN_ID, 0, 0, 0 ), 10, 5 ).generate( map );
		new OreGeneration( ColorIntUtil.getIntColor( 0, 0, 0, 0 ), 25, 10 ).generate( map );
		
		new PlayerGeneration( 64, 40 ).generate( map, light );
		light.setRGB( 64, 60, 0xffffffff );
		return this;
	}
	
}
